/*
 * Copyright 2023, Haiku, Inc. All rights reserved.
 * Distributed under the terms of the MIT License.
 */

#include "AntCalendarWindow.h"
#include "AntCalendarView.h"
#include "WeatherView.h"

#include <Catalog.h>
#include <LayoutBuilder.h>

#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "AntCalendarWindow"


AntCalendarWindow::AntCalendarWindow(BRect frame)
	:
	BWindow(frame, B_TRANSLATE("AntCalendar"), B_TITLED_WINDOW,
		B_AUTO_UPDATE_SIZE_LIMITS)
{
	// 创建日历视图
	fCalendarView = new AntCalendarView("calendarView");
	
	// 创建天气视图
	fWeatherView = new WeatherView("weatherView");
	
	// 使用布局构建器组织界面
	BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
		.Add(fWeatherView)
		.Add(fCalendarView)
		.SetInsets(B_USE_WINDOW_INSETS)
		.End();
}


AntCalendarWindow::~AntCalendarWindow()
{
}


bool
AntCalendarWindow::QuitRequested()
{
	be_app->PostMessage(B_QUIT_REQUESTED);
	return true;
}


void
AntCalendarWindow::MessageReceived(BMessage* message)
{
	switch (message->what) {
		default:
			BWindow::MessageReceived(message);
			break;
	}
}